Micron Document
🎖️GitЯра🎖️


Displaying Raw • Download

core/datastore/src/commonMain/kotlin/org/meshtastic/core/datastore/LocalStatsDataSource.kt bd2863243bab6eb213401d949839a2bc74dde7e2 (bd286324) Text, 1.98 KB

T8b949e/*
* Copyright (c) 2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.core.datastore

Tff7b72import T7ee787co.touchlab.kermit.Logger
Tff7b72import T7ee787kotlinx.coroutines.flow.Flow
Tff7b72import T7ee787kotlinx.coroutines.flow.catch
Tff7b72import T7ee787okio.IOException
Tff7b72import T7ee787org.koin.core.annotation.Single
Tff7b72import T7ee787org.meshtastic.core.datastore.di.CoreLocalStatsDataStore
Tff7b72import T7ee787org.meshtastic.proto.LocalStats

T8b949e/** Interface that handles saving and retrieving [LocalStats] data. */
Tff7b72interface T56d364LocalStatsDataSource Tb4b4b4{
Tff7b72val Te6edf3localStatsFlowTb4b4b4: Te6edf3FlowTff7b72<Te6edf3LocalStatsTff7b72>

Tff7b72suspend Tff7b72fun Td2a8ffsetLocalStatsTb4b4b4(Te6edf3statsTb4b4b4: Te6edf3LocalStatsTb4b4b4)

Tff7b72suspend Tff7b72fun Td2a8ffclearLocalStatsTb4b4b4(Tb4b4b4)
Tb4b4b4}

T8b949e/** Implementation of [LocalStatsDataSource] using DataStore. */
Tf0883e@Single
Tff7b72open Tff7b72class T56d364LocalStatsDataSourceImplTb4b4b4(Tff7b72private Tff7b72val Te6edf3localStatsStoreTb4b4b4: Te6edf3CoreLocalStatsDataStoreTb4b4b4) Tb4b4b4: Te6edf3LocalStatsDataSource Tb4b4b4{
Tff7b72override Tff7b72val Te6edf3localStatsFlowTb4b4b4: Te6edf3FlowTff7b72<Te6edf3LocalStatsTff7b72> Tff7b72=
Te6edf3localStatsStoreTb4b4b4.Te6edf3dataTb4b4b4.Te6edf3catch Tb4b4b4{ Te6edf3exception Tff7b72-Tff7b72>
Tff7b72if Tb4b4b4(Te6edf3exception Tff7b72is Te6edf3IOExceptionTb4b4b4) Tb4b4b4{
Te6edf3LoggerTb4b4b4.Te6edf3e Tb4b4b4{ Ta5d6ff"Ta5d6ffError reading LocalStats: Tffd700${Te6edf3exceptionTb4b4b4.Te6edf3messageTffd700}Ta5d6ff" Tb4b4b4}
Te6edf3emitTb4b4b4(Te6edf3LocalStatsTb4b4b4(Tb4b4b4)Tb4b4b4)
Tb4b4b4} Tff7b72else Tb4b4b4{
Tff7b72throw Te6edf3exception
Tb4b4b4}
Tb4b4b4}

Tff7b72override Tff7b72suspend Tff7b72fun Td2a8ffsetLocalStatsTb4b4b4(Te6edf3statsTb4b4b4: Te6edf3LocalStatsTb4b4b4) Tb4b4b4{
Te6edf3localStatsStoreTb4b4b4.Te6edf3updateData Tb4b4b4{ Te6edf3stats Tb4b4b4}
Tb4b4b4}

Tff7b72override Tff7b72suspend Tff7b72fun Td2a8ffclearLocalStatsTb4b4b4(Tb4b4b4) Tb4b4b4{
Te6edf3localStatsStoreTb4b4b4.Te6edf3updateData Tb4b4b4{ Te6edf3LocalStatsTb4b4b4(Tb4b4b4) Tb4b4b4}
Tb4b4b4}
Tb4b4b4}

Served by rngit 1.5.0 - Generated in 0.08s